import { request } from '@/utils/request'
// 获取文章频道列表
export const getChannels = () => {
    return request.get('/channels')
}
// 发表文章
export const publishArticle = (data) => {
    return request.post('/mp/articles?draft=false', data)
}
// 获取文章列表
export const getArticleList = (params = {}) => {
    // return request.get('/mp/articles', params)
    return request({
        url: '/mp/articles',
        method: 'get',
        params
    })
}
// 删除文章
export const deleteArticle = (id) => {
    return request.delete(`/mp/articles/${id}`)
}
// 更新文章表单
export function updateArticleAPI(data) {
    return request({
        url: `/mp/articles/${data.id}?draft=false`,
        method: 'PUT',
        data
    })
}
// 获取文章详情
export function getArticleById(id) {
    return request({
        url: `/mp/articles/${id}`
    })
}